from wtforms import StringField,SubmitField, BooleanField, SelectField, IntegerField, PasswordField
from flask_wtf import FlaskForm
from wtforms.validators import DataRequired

class NameForm(FlaskForm):
    id = IntegerField('Id') 
    name = StringField('Name?',validators=[DataRequired()]) 
    # 新增 SelectField，coerce=int 确保表单返回的是整数ID
    major = SelectField('Major', coerce=int)
    submit = SubmitField('Submit') 
   
class EditForm(NameForm):
    submit = SubmitField("Edit") 

# 登录表单
class LoginForm(FlaskForm):
    username = StringField('用户名', validators=[DataRequired()])
    password = PasswordField('密码', validators=[DataRequired()])
    remember_me = BooleanField('记住我')
    submit = SubmitField('登录')

# 注册表单
class RegistrationForm(FlaskForm):
    username = StringField('用户名', validators=[DataRequired()])
    password = PasswordField('密码', validators=[DataRequired()])
    password2 = PasswordField('确认密码', validators=[DataRequired()])
    submit = SubmitField('注册')